{
  "properties" : { },
  "id" : "fa647919b7b548b3ac681cb21aac5557",
  "script" : null,
  "groupId" : "97f65e4b68e1427f857047c67d7e3f42",
  "name" : "同步监控对象",
  "createTime" : 1727070898916,
  "updateTime" : 1724837523894,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "synchronous",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": 34\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }
}
================================

sql = """
    select id code,device_name target_name,device_type target_type,ip,device_name target_descr from ndmp_device
    where ip not in (select  ip from  alarm_target ) and  mtnc_Status = 0
    and ip not in (select DEVICE_ID from NDMP_DEVICE_BLACK_LIST)
"""

val = db.select(sql)

for (item in val) {
    item.enable = 1
}

// 批量插入
if (val.size != 0){
    return db.table("alarm_target").batchInsert(val)
}else {
    return 0
}





